package cn.wujiangbo.controller;

import cn.wujiangbo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 订单API
 */
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 下单接口（Jedis方式实现）
     */
    @PostMapping("/insertOrderForRedis")
    public ResponseEntity<String> insertOrderForRedis(@RequestParam("userId") Long userId) {
        return orderService.insertOrderForRedis(userId);
    }

    /**
     * 下单接口（Redission方式实现）
     */
    @PostMapping("/insertOrderForRedission")
    public ResponseEntity<String> insertOrderForRedission(@RequestParam("userId") Long userId) {
        return orderService.insertOrderForRedission(userId);
    }

    /**
     * 下单接口（ZK方式实现）
     */
    @PostMapping("/insertOrderForZK")
    public ResponseEntity<String> insertOrderForZK(@RequestParam("userId") Long userId) {
        return orderService.insertOrderForZK(userId);
    }

    /**
     * 下单接口（Curator方式实现）
     */
    @PostMapping("/insertOrderForCurator")
    public ResponseEntity<String> insertOrderForCurator(@RequestParam("userId") Long userId) {
        return orderService.insertOrderForCurator(userId);
    }
}
